float4x4 WVP;
float MaxHeight;
float MapWidth;
float MapHeight;
float CellSize;

//texture heightMapTexture;

//sampler HeightMapSampler = 
//sampler_state
//{
//	Texture = <heightMapTexture>;
//	MinFilter = Linear;
//	MagFilter = Linear;
//	MipFilter = Linear;
//	AddressU = Clamp;
//	AddressV = Clamp;
//};

struct VertexShaderInput
{
    float3 Position : POSITION;
	//float2 HeightMapCoord : TEXCOORD0;
};

struct VertexShaderOutput
{
	float4 oPosition : POSITION;
	float4 HeightColor : COLOR0;
};

struct PixelShaderInput
{
	float4 HeightColor : COLOR0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.HeightColor = float4(1.0f,1.0f,1.0f,1.0f);
	output.oPosition = mul(float4(input.Position, 1.0f), WVP);
	

	//float4 heightMapColor = tex2Dlod(HeightMapSampler, float4(input.HeightMapCoord.xy,0.0f,1.0f));
	//float color = float((heightMapColor.r + heightMapColor.g + heightMapColor.b) / 3.0f);
	//output.Position.y += color*MaxHeight;
	//output.HeightColor = float4(color,0.0f,0.0f,1.0f);
    return output;
}

float4 PixelShaderFunction(PixelShaderInput input) : COLOR0
{
	float4 color = float4(1.0f,1.0f,1.0f,1.0f);//float4(MaxHeight/input.HeightColor,input.oPosition.x/MapWidth,input.oPosition.z/MapHeight,1.0f);//(input.HeightColor / MaxHeight),0.0f,0.0f,1.0f);
    return input.HeightColor;
}

technique Technique1
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}
